<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tlds/workflow.tld" prefix="wf"%>
<%@ taglib uri="http://org.gocom.bpm.platform/tags/processgraph" prefix="p"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>流程图</title>
	<%@include file="/common.jsp"%>
	<%@include file="/common/common.jsp"%>
    <%@include file="/coframe/tools/skins/common.jsp" %>
	<script type="text/javascript" src="<%=request.getContextPath()%>/workflow/wfcomponent/web/js/Graphic.js"></script>
</head>
	<%
		String processID = request.getParameter("processID");
		String zoom = request.getParameter("zoomvalue");
	%>
	<body style="text-align:center;">	
		<p:processGraph processID="<%=processID%>" showNote="true" zoomQuotiety="1">
			 <p:activityGraph activityType="start" onclick="showStart()"/>
			 <p:activityGraph activityType="manual" onclick="openActivityDialog(event, this)"/>
			 <p:activityGraph activityType="finish" onclick="showFinish()"/>
		</p:processGraph>
		<script type="text/javascript">
		function openActivityDialog(e, actObj){
			// 兼容ff、ie	
			var event = e || window.event; 
			var strMsg = "";
			var activityDefID =actObj.getAttribute('activityDefID');
			var processDefID = "<%=processID %>";
        	var json = nui.encode({processDefID:processDefID,activityDefID:activityDefID});
	        $.ajax({
	            url: "com.atozsoft.wf.wfgraph.queryWorkItemNoteByIDefId.biz.ext",
	            type: 'POST',
	            data:json,
	            cache: false,
	            async: false,
	            contentType: 'text/json',
	            success: function(text) {
	                var data = text.datas[0];
	                //strMsg = "<p align=left><b>工作项：" + data.nodename +"</b><br/><b>描述：</b>" + data.nodecontent +"<br/><b>风险监控点及描述： </b>" + data.participantname +"<br/><b>操作说明：</b>" + data.operation + "</p>";
	                strMsg = "<p align=left><b>工作项：" + data.nodename +"</b></p>";
	          }
	        });
	        
	       /* var x = event.clientX;
	        var y = event.clientY; */
	        /* add by chenhe*/
			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
            var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
            var x = event.pageX || event.clientX + scrollX;
            var y = event.pageY || event.clientY + scrollY;
	        var state = "info";
	        mini.showTips({
	            content: strMsg,
	            state: state,
	            x: x,
	            y: y,
	            timeout: 1000
	        });  
		}
		
		function showStart(){
			//tips显示内容
			var strMsg = "流程实例启动！";
			//tips显示背景
			var state = "info";
			/* var x = event.clientX;
	        var y = event.clientY; */
	        
			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
            var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
            var x = event.pageX || event.clientX + scrollX;
            var y = event.pageY || event.clientY + scrollY;
	        mini.showTips({
	            content: strMsg,
	            state: state,
	            x: x,
	            y: y,
	            timeout: 1000
	        });
		}
		
		function showFinish(){
			//tips显示内容
			var strMsg = "流程实例结束！";
			//tips显示背景
			var state = "info";
			/* var x = event.clientX;
	        var y = event.clientY; */
	        
			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
            var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
            var x = event.pageX || event.clientX + scrollX;
            var y = event.pageY || event.clientY + scrollY;
	        mini.showTips({
	            content: strMsg,
	            state: state,
	            x: x,
	            y: y,
	            timeout: 1000
	        });
		}
	</script>
	</body>
</html>
